Socket
Socket
Sign inDemoInstall

pre-suf

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pre-suf

Manipulate strings with prefixes and suffixes.


Version published
Weekly downloads
529
decreased by-8.79%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

pre-suf

Manipulate strings with prefixes and suffixes.

Install

$ npm install pre-suf --save

Usage

const presuf = require('pre-suf')

presuf.ensureLeading('path/to', '/')    // '/path/to'
presuf.removeEnding('/path/to//', '/')  // '/path/to'

presuf.ensureLeading(str, prefix)

Ensures that the new string will have prefix at the beginning of str.

If str does not begin with prefix, prefix will be added to the beggining of str.

presuf.removeLeading(str, prefix)

Removes the leading prefix of str.

presuf.removeLeading('/abc', '/a')       // 'bc'
presuf.removeLeading('/a/abc', '/a')     // 'bc'. removes 2 groups of '/a'

presuf.ensureEnding(str, suffix)

presuf.removeEnding(str, suffix)

License

MIT

Keywords

FAQs

Package last updated on 17 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc